<?php
class ArticleController extends Zend_Controller_Action
{   
    public function listerarticleAction() 
    {    
    	//on cree les diferrente tables
       $articles= new Table_Articles();
       $vips=new Table_Vips();
       $apourSujet=new Table_Sujets();
       
       $articleAff=null;
       $vipArt=null;
       
       //on recupere les parametres
       $numVip=$this->_getParam('numVip');
       
       
       $allVIP=$vips->getAllVIP();
       
       
       $i=0;
       foreach($allVIP as $unVip)
       {
	       	$mesVip[$i]=$unVip;
	       	$i++;       	
       }
       
       if(!empty($numVip))
       {
       	 	$vipArt=$vips->getVIPByNumero($numVip);
       		$sujetAff=$apourSujet->getSujetsByNumVip($numVip);
       		$i=0;
       		foreach($sujetAff as $unSujet)
       		{
       			$articleAff[$i]=$articles->getArticleByNum($unSujet->ARTICLE_NUMERO);
       			$i++;       			
       		}
       		
       	
       }
       
       $this->view->listerarticle=array(
       							'vips' => $mesVip,
       							'articles' => $articleAff,
       							'VipArticle'=> $vipArt);
        
    }
    
   
 	
}// fin classe
?>